<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
	<!--头部-->
	<div th:replace="common/admin-header.html :: adminHeader ('系统用户')"/>
	<body>
		<div class="page-content-wrap">
				<form class="layui-form" th:action="@{${path} + '/admin/sys/user/list'}" method="post" id="sysUserForm">
					<div class="layui-form-item">
						<input type="hidden" id="pageNum" name="pageNum" th:value="${sysUserList.pageNum}">
						<div class="layui-inline tool-btn">
							<button class="layui-btn layui-btn-small addBtn layui-btn-normal  hidden-xs" data-str="系统用户" th:attr="data-url=@{${path} + '/admin/sys/user/to/modify?id=0'}"><i class="layui-icon">&#xe654;</i></button>
						</div>
						<div class="layui-inline">
							<input type="text" id="username" name="username" th:value="${sysUser.username}"  placeholder="请输入用户名" autocomplete="off" class="layui-input">
						</div>
						<div class="layui-inline">
							<select name="status">
								<option value="-1" th:attr="selected=${sysUser.status!=0 && sysUser.status!=1 ? true : false}">全部</option>
								<option value="0" th:attr="selected=${sysUser.status==0 ? true : false}">正常</option>
								<option value="1" th:attr="selected=${sysUser.status==1 ? true : false}">冻结</option>
							</select>
						</div>
						<button class="layui-btn layui-btn-normal" lay-submit="search">搜索</button>
					</div>
				</form>
				<div class="layui-form" id="table-list">
					<table class="layui-table" lay-skin="line">
						<thead>
							<tr>
								<th class="hidden-xs">ID</th>
								<th class="hidden-xs">用户名</th>
								<th class="hidden-xs">手机号</th>
								<th>性别</th>
								<th>状态</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody>
							<tr class="parent collapsed" th:each="sysUser,sysUserStat : ${sysUserList}">
								<td class="hidden-xs" th:text="${sysUser.id}"></td>
								<td class="hidden-xs" th:text="${sysUser.username}"></td>
								<td class="hidden-xs" th:text="${sysUser.phone}"></td>
								<td th:text="${sysUser.sex==0 ? '男' : '女'}"></td>
								<td th:text="${sysUser.status==0 ? '正常' : '冻结'}"></td>
								<td>
									<div class="layui-inline">
										<button class="layui-btn layui-btn-mini layui-btn-normal  edit-btn"  th:attr="data-url=@{${path} + '/admin/sys/user/to/modify?id=' + ${sysUser.id}}">编辑</button>
										<button class="layui-btn layui-btn-mini layui-btn-normal edit-pass" th:attr="data-id=@{${sysUser.id}}">改密</button>
										<button class="layui-btn layui-btn-mini layui-btn-normal edit-status" th:attr="data-id=${sysUser.id},data-status=@{${sysUser.status==0 ? 1 : 0}}" th:text="${sysUser.status==0 ? '冻结' : '恢复'}"></button>
										<button class="layui-btn layui-btn-mini layui-btn-danger edit-status" th:attr="data-id=${sysUser.id}" data-status="2">删除</button>
									</div>
								</td>
							</tr>
						</tbody>
					</table>
					<div id="sysUserPage" style="float: right"></div>
				</div>
		</div>
		<script th:src="@{${path} + '/js/jquery-2.1.4.min.js'}"  type="text/javascript" charset="utf-8"></script>
		<script th:src="@{${path} + '/admin/layui/layui.js'}"  type="text/javascript" charset="utf-8"></script>
		<script th:src="@{${path} + '/admin/js/sysUser/sysUser.js'}"  type="text/javascript" charset="utf-8"></script>
		<script>
			layui.use(['jquery','laypage'], function() {
				var laypage = layui.laypage;
				var $ = layui.jquery;
				laypage({
					cont: 'sysUserPage'
					,curr: [[${sysUserList.pageNum}]]
					,pages: [[${sysUserList.pages}]] //总页数
					,groups: 5 //连续显示分页数
					,skin:'#3fa9ff'
					,jump: function(obj, first){
						//得到了当前页，用于向服务端请求对应数据
						var curr = obj.curr;
						if(curr != $("#pageNum").val()){
							$("#pageNum").val(curr);
							$(".layui-form").submit();
						}
					}
				});
			});
		</script>
	</body>

</html>